# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-pg_variables
pkgver=1.2.5_git20230922
_gitrev=67b5121228ba643ef4708aa1e8c9662437b16990
pkgrel=0
pkgdesc="Session wide variables for PostgreSQL"
url="https://github.com/postgrespro/pg_variables"
arch="all"
license="PostgreSQL"
makedepends="postgresql-dev"
subpackages="$pkgname-bitcode"
source="https://github.com/postgrespro/pg_variables/archive/$_gitrev/postgresql-pg_variables-$_gitrev.tar.gz"
builddir="$srcdir/pg_variables-$_gitrev"
options="!check"  # tests require running PostgreSQL

build() {
	make USE_PGXS=1
}

package() {
	_pgver=$(pg_config --major-version)
	depends="postgresql$_pgver"

	make USE_PGXS=1 DESTDIR="$pkgdir" install
}

bitcode() {
	_pgver=$(pg_config --major-version)
	pkgdesc="$pkgdesc (bitcode for JIT)"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="postgresql$_pgver-jit $pkgname=$pkgver-r$pkgrel"

	amove usr/lib/postgresql*/bitcode
}

sha512sums="
60e859011a43240d6f07425f186065e6d4f012bdfdbbdd0371cf00186468f0d842d09d9ef461ca0ac3bec91e99cb218aa39b03003c54fbad4a06af89193da9bc  postgresql-pg_variables-67b5121228ba643ef4708aa1e8c9662437b16990.tar.gz
"
